//
//  AppDelegate.m
//  MapMarker
//
//  Created by 罗亮富 on 2018/12/17.
//  Copyright © 2018年 Roen. All rights reserved.
//

#import "AppDelegate.h"
#import "MainViewController.h"
#import "MainWindowController.h"

@interface AppDelegate ()

@property (readonly) NSWindow *window;

@property (nonatomic, strong) MainWindowController *mainWindowController;

@end

@implementation AppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
   
    MainViewController *mainVc = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
    self.mainWindowController = [[MainWindowController alloc] initWithWindowNibName:@"MainWindowController"];
    self.mainWindowController.contentViewController = mainVc;
    [self.mainWindowController showWindow:nil];
}

- (void)applicationWillTerminate:(NSNotification *)aNotification {
    // Insert code here to tear down your application
}

//在点击了window的关闭按钮后，可以再点击dock中的app icon重新恢复窗口
-(BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
{
    [self.window makeKeyAndOrderFront:nil];
    return YES;
}

-(NSWindow *)window {
    return self.mainWindowController.window;
}


@end
